package org.onion.pattern.kit.springtool.retry;


import org.onion.pattern.kit.springtool.exception.RetryableException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;

import java.lang.annotation.*;

/**
 * 领域版本冲突重试，规则：
 * 1. 最多重试 2 次， 含首次
 * 2. 每次间隔 100ms , 第下一次是上一次的 1.5 倍 , 最大间隔 500ms
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Retryable(value = RetryableException.class, maxAttempts = 2, backoff = @Backoff(delay = 100, multiplier = 1.5, maxDelay = 500),
        interceptor = "domainVersionRetryMethodInterceptor")
public @interface VersionRetry {


}
